home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-01-02 | 4.1 KB | 85 lines | [TEXT/GEOL] |
- Item 5809610 2-Jan-90 11:29
-
- From: LAI1 Lai, Edmund
-
- To: MACAPP.TECH$ MacApp Technical
-
- Sub: Re: view initialization
-
- James Plamondon wrote:
-
- *****
- If a view needs to contain an explicit reference to another view, the
- reference often cannot be initialized during IRes(), because the view being
- referenced may not have been created yet. Only those views preceding a given
- view in an in-order traversal of the view hierarchy have been created when
- IRes() is called on the given view. A call to FindSubView() will fail if the
- view being sought has not yet been created.
-
- If the distinction between creation and initialization were made, this would
- not be a problem. First, the tree would be traversed, creating all of the
- specified views. Once all were created, then the tree would be traversed
- again, allowing each specified view to initialize itself. Since all of the
- views in the hierarchy would exist during the initialization phase, all calls
- to FindSubView() would work properly.
- *****
-
- There are a number of responding links indicating that this is not an isolated
- problem and wishes for a solution in post 2.0 MACAPP. However does the
- distinction between creation and initialization of view completely solves the
- problem? It all depends on what explicit reference to another subview means. If
- it means something like
-
- subViewX := FindSubView(id1);
- fSubViewX := subViewX;
-
- then this would work.
-
- But if what you are trying to do during initialization is
-
- subViewX := FindSubView(id1);
- FailNil(subViewX);
- subViewX.doABC;
- subViewX := FindSubView(id2);
- FailNil(subViewX);
- subViewX.doXYZ;
-
- then this is no better since when you try to doABC or doXYZ, even though
- subViewX points to an ojbect, that object is not initialized. This indicates we
- need a more radical solution to the problem. However James also indicated the
- general response is that people are unwilling to change even for his less
- radical solution, then why would people be willing to accept a more radical
- solution. I think that depends on whether the more radical solution can solve a
- much wider classes of problem, then maybe people may be more willing to accept
- it.
-
- Let us step back a little bit and see what 'view' resources really do. A MACAPP
- TView is really a network of objects, by which I mean a group of objects that
- have object reference to each other. A 'view' resource is really a flat
- representation of the network in which there is no direct object reference in
- memory so that it can be stored permanently into the disk. The process of
- reading from a template is really to restore the network of objects with all
- the memory object references from its persistent state. In other words the
- 'view' resource and the IRes, WRes are really a mechanism for persistent
- objects. Of course this is not general persistent objects since it is
- restricted to TView objects and its subclasses. Because of this restriction the
- MACAPP view template implementation makes uses of the assumption that views are
- hierarchical, superviews are created before their subviews etc. While this
- simplifies the implementation, it makes it impossible to use the same
- implementation for persistent state of arbitrary network of objects where the
- object references are usually not hierarchical. And now we find out even for
- views there are cases where such assumptions is making life difficult for us.
-
- If we can come up with a general persistent object scheme for an arbitrary
- network of objects (this can be done, but I am not going into the details),
- then we have solved the view problem (since views can be considered to be a
- special case of the general scheme). We would also be solving problems in many
- other areas. The documents in the DrawShape program can now be just the
- persistent state of the shapes object. Network of objects can now be exported
- to the clipboard or through IPC to go to another application (Imagine coping a
- view to ViewEdit, edit it and then paste it back). To do all these it will be
- necessary to modify your IRes and WRes routines somewhat, but I think the
- additional benefits would make it worthwhile.
-
-
-